home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
tpref.exe
/
SOURCE.EXE
/
KEYTEST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-08-07
|
858b
|
36 lines
{ KEYTEST.PAS }
Program KeyTest;
Uses
Crt;
Var
Code : Integer;
Function GetKey : Integer;
{ Pauses for input of a single keystroke from the keyboard and returns
the ASCII value. In the case where an Extended keyboard key is pressed,
GetKey returns the ScanCode + 256. The Turbo Pascal ReadKey function
is called to perform the keystroke input. This routine returns a 0
when an Extended key has been typed (e.g. left or right arrow) and we
must read the next byte to determined the Scan code.
}
Var
Ch : Char;
Begin
Ch := ReadKey;
If Ord(Ch) <> 0 Then
GetKey := Ord(Ch) { Return normal ASCII value }
Else
Begin
{ Read the DOS Extended SCAN code that follows }
GetKey := Ord(ReadKey) + 256;
End;
End;{GetKey}
Begin
Repeat
Code := GetKey;
Writeln(Code);
Until Code = 27;
End.